package com.lp.yupao.service;

import com.lp.yupao.model.domain.Team;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lp.yupao.model.domain.request.TeamJoinRequest;
import com.lp.yupao.model.domain.request.TeamSearchRequest;
import com.lp.yupao.model.domain.request.TeamUpdateRequest;
import com.lp.yupao.model.vo.TeamVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author lp337
 * @description 针对表【team(队伍)】的数据库操作Service
 * @createDate 2024-05-18 21:01:51
 */
public interface TeamService extends IService<Team> {

    /**
     * 创建队伍
     *
     * @param teamRequest 队伍数据
     * @param request     请求
     * @return 队伍id
     */
    long createTeam(Team teamRequest, HttpServletRequest request);

    /**
     * 删除队伍
     *
     * @param teamId  队伍id
     * @param request 请求
     * @return 是否删除成功
     */
    long deleteTeamById(long teamId, HttpServletRequest request);

    /**
     * 更新队伍信息
     *
     * @param teamRequest 队伍信息
     * @param request     请求
     * @return 更新后的队伍信息
     */
    long updateTeam(TeamUpdateRequest teamRequest, HttpServletRequest request);

    /**
     * 根据条件查询队伍数据（支持分页）
     *
     * @param teamSearchRequest 查询条件
     * @param request           请求
     * @return 队伍数据列表
     */
    List<TeamVO> searchTeamList(TeamSearchRequest teamSearchRequest, HttpServletRequest request);

    /**
     * 加入队伍
     *
     * @param teamJoinRequest 请求参数（队伍id，密码）
     * @param request         请求
     * @return 是否加入成功
     */
    int insertTeam(TeamJoinRequest teamJoinRequest, HttpServletRequest request);

    /**
     * 退出队伍
     *
     * @param teamId  队伍id
     * @param request 请求
     * @return 是否退出成功
     */
    int quitTeam(long teamId, HttpServletRequest request);

    /**
     * 通过队伍id查队伍信息
     *
     * @param teamId  队伍id
     * @param request 请求
     * @return 队伍信息
     */
    Team getTeamById(long teamId, HttpServletRequest request);

    /**
     * 查询我创建的队伍
     *
     * @param searchText 关键字
     * @param request 请求
     * @return 队伍列表
     */
    List<TeamVO> getMyCreateTeam(String searchText, HttpServletRequest request);

    /**
     * 查询我加入的队伍
     *
     * @param searchText 关键字
     * @param request 请求
     * @return 队伍列表
     */
    List<TeamVO> getMyJoinTeam(String searchText, HttpServletRequest request);
}
